package com.spdd.mt.common.validator.constraint;

import cn.hutool.core.lang.Validator;
import com.spdd.mt.common.validator.Mobile;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class MobileValidator implements ConstraintValidator<Mobile, String> {
    @Override
    public boolean isValid(String bool, ConstraintValidatorContext constraintValidatorContext) {

        if (bool == null) {
            return true;
        }

        // 参数校验
        if (Validator.isMobile(bool)) {
            return true;
        }

        return false;
    }
}
